package codechicken.wirelessredstone.core;

import net.minecraft.src.EntityPlayer;
import net.minecraft.src.World;

public class CorePacketHandler implements IWirelessPacketHandler
{
	public void handlePacket(World world, EntityPlayer player, PacketRedstoneEther packet)
	{
		switch(packet.getType())
		{
			case 1:
				RedstoneEther.jamAllFrequencies(player);
			break;
			case 2:
				RedstoneEther.setLastPublicFrequency(packet.readShort());
			break;
			case 3:
				RedstoneEther.setFrequencyRange(player, packet.readShort(), packet.readShort(), packet.readBoolean());
			break;
			case 4:
				int freq = packet.readShort();
				RedstoneEther.setFreqName(freq, packet.readString());
				RedstoneEther.setFreqColour(freq, packet.readByte());
			break;
			case 6:
				RedstoneEther.resetClient();
			break;
			case 7:
				RedstoneEther.jamEntity(player, packet.readBoolean());
			break;
		}
	}
	
	public static void sendSetFreqInfo(int freq, String name, int colourid)
	{
		PacketRedstoneEther packet = new PacketRedstoneEther(4);
		packet.writeShort((short) freq);
		packet.writeString(name);
		packet.writeByte((byte)colourid);
		CoreProxy.sendPacket(packet);
	}
	
	public static void sendSetSlot(int slot, int itemid, int quantity, int damage)
	{
		PacketRedstoneEther packet = new PacketRedstoneEther(5);
		packet.writeShort((short)slot);
		packet.writeShort((short)itemid);
		packet.writeByte((byte)quantity);
		packet.writeShort((short)damage);
		CoreProxy.sendPacket(packet);
	}

	public static void sendPublicFrequencyTo(EntityPlayer player, int publicfrequencyend)
	{
	}

	public static void sendJamAllFrequenciesTo(EntityPlayer player)
	{
	}

	public static void sendSetFrequencyRangeTo(EntityPlayer player, int firstfreq, int lastfreq, boolean jam)
	{
	}

	public static void sendSetFreqInfoTo(EntityPlayer player, int freq, String freqname, int colourid)
	{
	}

	public static void sendResetClientTo(EntityPlayer player)
	{
	}

	public static void sendJamPlayerPacketTo(EntityPlayer player, boolean jam)
	{
	}
}
